<!DOCTYPE html>
<html>
<head>
<base href="${basePath}">
<meta charset="UTF-8">
<title>修改状态信息</title>
$!{include("import_js_css.html")}
</head>
<body>
	$!{include("header.html")}
	<div class="container menu_all">
		<div class="div_search_result">
			<div class="panel-heading panel-result-title">
				<h3 class="panel-title">修改状态</h3>
			</div>
			<div id="div_result_member" style="padding: 15px;">
			<!--#var(Status statu)-->
				<form class="form-horizontal" role="form" action="yueyogaAdmin/editStatus.jhtml" method="post" enctype="multipart/form-data">
					<div class="form-group">
						<label for="inputName" class="col-sm-1 control-label">状态名称</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" name="name" id="inputName" value="${statu.name}" >
						</div>
						<label for="inputCode" class="col-sm-1 control-label">状态编号</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" name="code" id="inputCode" value="${statu.code}">
						</div>
						<br /><br />
						<label for="inputType" class="col-sm-1 control-label">状态类型</label>
						<div class="col-sm-3">
							<select id="inputType" data-live-search="true"
								class="selectpicker show-tick" data-width="100%" name="inputType">
								<option value="">请选择状态类型</option>
								<option value="1">会员状态</option>
								<option value="2">班级状态</option>
								<option value="3">销售状态</option>
								<option value="4">任务状态</option>
								<option value="5">市场渠到</option>
							</select>
						</div>
						<label for="inputParentCode" class="col-sm-1 control-label">上级状态</label>
						<div class="col-sm-3">
							<!--#var(Status status, List<Status> statuses)-->
							<!--#var(Status parentStatus)-->
							<select id="parentcode" data-live-search="true"
								class="selectpicker show-tick" data-width="100%" name="parentcode">
								<option value="">顶级状态</option>
								<!--#foreach(status in statuses)-->
								<option value="${status.code}">${status.name}</option>
								<!-- #end -->
							</select>
						</div>
						<br /><br />
						<div class="col-sm-offset-2" style="margin: 40px 120px 0 0; float: right;">
							<button type="submit" class="btn btn-default">添加</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</body>
</html>
<script>
$("#inputType").change(function() {
	var inputType=$("#inputType").val();
	$.post(
		"yueyogaAdmin/findStatusBytype.jhtml",
		{"type": inputType},
		function(response) {
			var res = eval("(" + response + ")");
			var sub = document.getElementById("parentcode");
			sub.options.length=0;
			if (res.success) {
				var option = null;
				var code = null;
				var name = null;
				option = new Option("顶级状态", "");
				sub.options.add(option);
				for(var i=0;i<res.items.length;i++) {
					code = res.items[i].code;
					name = res.items[i].name;
					option = new Option(name, code);
					sub.options.add(option);
				}
			} else {
				option = new Option("顶级状态", "");
				sub.options.add(option);
			}
		}
	);
});
$("#inputType").val('${statu.type}');
$("#parentcode").val('${statu.parentcode}');
$('.selectpicker').select2({placeholder:'请选择'});
</script>